package it.oneb.study.multiThread;

public class NomalProducer
{

	private ThreadLocal<Integer> counter = new ThreadLocal<Integer>()
	{
		@Override
		protected Integer initialValue()
		{
			return 0;
		}
	};
	
	private Integer ntsCounter = 0;
	public void run()
	{
		for (int i=0;i<10;i++)

		{
			System.out.println(Thread.currentThread().getName()+ " thread safe:　"+counter.get());
			counter.set(counter.get()+1);
			
			System.out.println(Thread.currentThread().getName()+ " non-thread safe:　"+ ntsCounter);
			ntsCounter++;
		}

	}
}
